#include <bits/stdc++.h>

using namespace std;

int main() {
    string s;
    cin >> s;
    bool val;
    int ans1 = 0, ans2 = 0, off = 0;
    int i = 0;
    int n = s.size();
    while (i < n) {
        if (off == 0) {
            if (s[i] == '0') {
                val = false;
            } else if (s[i] == '1') {
                val = true;
            } else if (s[i] == '&' && !val) {
                off = 1;
                ans1++;
            } else if (s[i] == '|' && val) {
                off = 2;
                ans2++;
            }
            i++;
        } else {
            if (s[i] == '(') {
                int depth = 1;
                i++;
                while (depth > 0 && i < n) {
                    if (s[i] == '(') {
                        depth++;
                    } else if (s[i] == ')') {
                        depth--;
                    }
                    i++;
                }
            } else if ((off == 1 && s[i] == '|') || s[i] == ')') {
                off = 0;
                i++;
            } else {
                if (off == 1 && s[i] == '&') {
                    ans1++;
                } else if (off == 2 && s[i] == '|') {
                    ans2++;
                }
                i++;
            }
        }
    }
    cout << val << endl;
    cout << ans1 << " " << ans2 << endl;
    return 0;
}
